package com.wjf.ks_test.vo;

import lombok.Data;

/**
 * @author 吴建飞
 * @version 1.0
 * @since 2024/11/11
 */
@Data
public class Vertex {
    private double x;
    private double y;
    public Vertex(){

    }

    public Vertex(double x, double y) {
        this.x = x;
        this.y = y;
    }
    /**
     * 计算两顶点之间的距离
     * @param other
     * @return 两点距离
     */
    public double calcDistance(Vertex other) {
        double dx = this.x - other.x;
        double dy = this.y - other.y;
        return Math.sqrt(dx * dx + dy * dy);
    }

    public double getX() {
        return x;
    }

    public double getY() {
        return y;
    }
}
